/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package taikai;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.Reader;
import java.util.ArrayList;

public class TaikaiFile {

    boolean teamEvent;
    ArrayList<String[]> people = new ArrayList<String[]>();
    String duration;

    void load(Reader in) throws IOException {
        final BufferedReader reader = new BufferedReader(in);

        for(String line = reader.readLine();line!=null;line = reader.readLine()) {
            if(line.indexOf(':')>0) {
                final String tag = line.split(":", 2)[0];
                final String data = line.split(":", 2)[1];

                if(tag.equals("teamEvent")) {
                    teamEvent = Boolean.parseBoolean(data);
                }

                if(tag.equals("duration")) {
                    duration = data;
                }

                if(tag.equals("person")) {
                    final String[] fields = data.split(",");
                    for(int i=0; i<fields.length;i++) {
                        fields[i]  = fields[i].trim();
                    }
                    people.add(fields);
                }
            }

        }
    }

}
